#ifndef EVENTQUEUE_H
#define EVENTQUEUE_H

#include "room_global.h"
#include <boost/noncopyable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <deque>

class Event;

class EventQueue :
        protected boost::noncopyable
{
public:
    typedef boost::mutex Mutex;
    typedef boost::condition Condition;
    typedef boost::shared_ptr< Event > EventPtr;
    typedef std::deque< EventPtr > Queue;

public:
    EventQueue();
    ~EventQueue();

    void postEvent(const EventPtr &ev);
    void peekEvent(EventPtr &ev);

    size_t size();

private:
    Queue m_queue;

    Mutex m_lock;

    Condition m_waiter;
};

#endif // EVENTQUEUE_H
